#include "categoryinfo.h"

CategoryInfo::CategoryInfo() {}

bool CategoryInfo::WriteXML(QXmlStreamWriter &writer){
    writer.writeStartElement("CategoryInfo");
    writer.writeAttribute("key",QString::number(m_nKey));
    writer.writeCharacters(m_strName);
    writer.writeEndElement();
    return true;
}

bool CategoryInfo::ReadXML(QXmlStreamReader &reader){
    //QXmlStreamReader::TokenType token = reader.readNext();
    QString className = reader.name().toString();

    QXmlStreamAttributes attributes = reader.attributes();
    if(attributes.hasAttribute("key")) {
        m_nKey = attributes.value("key").toString().toInt();
    }

    m_strName = reader.readElementText();
    return true;
}


